<layout name='layout_page' />

<div class="row">
	<div class="col-lg-12">
		<div class="row">
			<div class="col-lg-12">
				<ol class="breadcrumb">
					<li><a href="<{:U('Index/index')}>">Home</a></li>
					<li>Mentees</li>
					<li class="active"><span>My need</span></li>
				</ol>
				<h1>My need</h1>
			</div>
		</div>

		<div class="row">
			<div class="col-lg-12">
				<div class="main-box clearfix">
					<form id="ajaxForm" action="<{:U('Need/alldel')}>" method="post" class="form-horizontal form-validata">
					<input type="hidden" name="type" value="inbox"/>
					<header class="main-box-header clearfix">
						<div class="filter-block pull-left">	
							<div class="checkbox-nice" style="display:inline-block; margin-left:5px">
							<input type="checkbox" id="checkall" name="checkall" onClick="CheckAll(this.form)">
							<label for="checkall"></label>
							</div>
							<a href="<{:U('Need/add')}>" class="btn btn-default"><i class="fa fa-plus"></i> Add need</a>	
							<button type="submit" class="btn btn-danger" id="myBtn"><i class="fa fa-trash-o"></i> Delete</button>	
						</div>
					</header>
					<div class="main-box-body clearfix">
						<div class="table-responsive clearfix">
							<table class="table user-list table-hover">
								<thead>
									<tr>
										<th width="50"></th>
										<th width="150">subject</th>
										<th>target</th>
										<th class="text-center" width="150">status</th>
										<th class="text-center" width="130"><span>Time</span></th>
										<th class="text-center" width="130"><span>active</span></th>
									</tr>
								</thead>
								<tbody>
									<volist name="list" id="vo">
									<tr>
										<td>
										<div class="checkbox-nice">
										<input type="checkbox" id="m-checkbox-<{$vo.id}>" name="selectedids[]" value="<{$vo.id}>">
										<label for="m-checkbox-<{$vo.id}>"></label>
										</div>
										</td>
										<td><{$vo.trainItem}></td>
										<td><{$vo.target}></td>
										<td class="text-center">
										<?php if($vo['status']==1){ ?>
										<span class="label label-success">Active</span>
										<?php }else{ ?>
										<span class="label label-default">Inactive</span>
										<?php } ?>
										</td>
										<td class="text-center"><{$vo.createTime|date="F,d,Y H:i:s",###}></td>
										<td class="text-center">
											<a href="<{:U('Need/view',array('id'=>$vo['id']))}>" class="table-link"> <span class="fa-stack"> <i class="fa fa-square fa-stack-2x"></i> <i class="fa fa-search-plus fa-stack-1x fa-inverse"></i> </span> </a> <a href="<{:U('Need/del',array('id'=>$vo['id']))}>" class="table-link danger"> <span class="fa-stack"> <i class="fa fa-square fa-stack-2x"></i> <i class="fa fa-trash-o fa-stack-1x fa-inverse"></i> </span> </a>
										</td>
									</tr>
									</volist>									
								</tbody>
							</table>
						</div>
					</div>
					</form>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-12">
				<div class="page">
					<nav>
	  					<ul class="pagination"><{$page}></ul>
	  				</nav>
	  			</div>
			</div>
		</div>	
	</div>
</div>
<script type="text/javascript">
$(function(){
	$('#ajaxForm').ajaxForm({
		beforeSubmit:function(){
			$("#alertModal").modal('show');
		},
		success:function(responseText, statusText){
			if (statusText == 'success') {
				var responseText=eval('('+responseText+')');
				var url=responseText.url;
				if(responseText.state == 'SUCCESS'){
					$("#alertModal .modal-body").html('<div class="loading"><i class="fa fa-check fa-4x"></i> '+responseText.message+'</div>');
					if(url!='' && url!=undefined && url!="undefined"){
						setTimeout(function(){
							window.location.href = url;   
						},1000);
			        }else{
			        	setTimeout("$('#alertModal').modal('hide')",2000);
			        }
				}else{
					_alert(responseText.message,url);
				}			
			}
		}
	})
});
</script>